package com.online.college.common.pay;

//import com.cppba.alipay.base.enums.SignEnum;
import com.online.college.common.util.PropertiesUtil;

import java.util.Properties;

public class AliPayConfig {
    /**
     * 是否沙箱环境
     */
    private static final  Boolean isTest;
    /**
     * 应用ID
     */
    private static final  String appId;
    /**
     * 应用私钥
     */
    private static final  String privateKey;
    /**
     * 支付宝公钥
     */
    private static final  String alipayPublicKey;
    /**
     * 签名方式
     * RSA,RSA2
     */
    private static final  String signType;
    /**
     * 支付异步回调地址
     */
    private static final  String notifyUrl;
    /**
     * 订单过期时间
     */
    private static final  String timeoutExpress;

    private static final String pid;

    static {
        Properties properties = PropertiesUtil.getDefaultProperties();
        String test = properties.getProperty("alipay.is-test");
        if("true".equals(test)){
            isTest = true;
        }else {
            isTest = false;
        }
        appId = properties.getProperty("alipay.app-id");
        privateKey = properties.getProperty("alipay.private-key");
        alipayPublicKey = properties.getProperty("alipay.alipay-public-key");
        signType = properties.getProperty("alipay.sign-type");
//        if ("RSA2".equals(type)){
//            signType = SignEnum.RSA2;
//        }else{
//            signType = SignEnum.RSA;
//        }
        notifyUrl = properties.getProperty("alipay.notify-url");
        timeoutExpress = properties.getProperty("alipay.timeout-express");
        pid =  properties.getProperty("alipay.pid");

    }

    public String getPid() {
        return pid;
    }

    public Boolean getIsTest() {
        return isTest;
    }

    public String getAppId() {
        return appId;
    }

    public String getPrivateKey() {
        return privateKey;
    }

    public String getAlipayPublicKey() {
        return alipayPublicKey;
    }

    public String getSignType() {
        return signType;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public String getTimeoutExpress() {
        return timeoutExpress;
    }
}
